generated from cds-snc/project-template
-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: setup narrower guardrails against aws Nuke #300
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
patheard
approved these changes
Jul 23, 2024
sylviamclaughlin
approved these changes
Jul 23, 2024
Plan for org_account/organization✅ Terraform Init: Plan: 2 to add, 0 to change, 0 to destroy Show summary
Show planResource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# aws_organizations_policy.aws_nuke_guardrails will be created
+ resource "aws_organizations_policy" "aws_nuke_guardrails" {
+ arn = (known after apply)
+ content = jsonencode(
{
+ Statement = [
+ {
+ Action = [
+ "iam:DetachRolePolicy",
+ "iam:DeleteRolePolicy",
+ "iam:DeleteRole",
]
+ Condition = {
+ ArnNotLike = {
+ "aws:PrincipalArn" = "arn:aws:iam::*:role/AWSAFTExecution"
}
}
+ Effect = "Deny"
+ Resource = [
+ "arn:aws:iam::*:role/aws-service-role/*",
+ "arn:aws:iam::*:role/AWSControlTower*",
]
+ Sid = "ProtectAWSControlTowerRoles"
},
+ {
+ Action = "iam:DeleteSAMLProvider"
+ Condition = {
+ ArnNotLike = {
+ "aws:PrincipalArn" = "arn:aws:iam::*:role/AWSAFTExecution"
}
}
+ Effect = "Deny"
+ Resource = "arn:aws:iam::*:saml-provider/AWSSSO_*_DO_NOT_DELETE"
+ Sid = "ProtectSAMLProvider"
},
+ {
+ Action = [
+ "iam:DetachRolePolicy",
+ "iam:DeleteRolePolicy",
+ "iam:DeleteRole",
]
+ Condition = {
+ ArnNotLike = {
+ "aws:PrincipalArn" = "arn:aws:iam::*:role/AWSAFTExecution"
}
}
+ Effect = "Deny"
+ Resource = "arn:aws:iam::*:role/AWSReservedSSO_*"
+ Sid = "ProtectSSORoles"
},
+ {
+ Action = [
+ "iam:DetachRolePolicy",
+ "iam:DeletePolicy",
]
+ Condition = {
+ ArnNotLike = {
+ "aws:PrincipalArn" = "arn:aws:iam::*:role/AWSAFTExecution"
}
}
+ Effect = "Deny"
+ Resource = "arn:aws:iam::*:policy/AWSReservedSSO_*"
+ Sid = "ProtectSSORolePolicies"
},
]
+ Version = "2012-10-17"
}
)
+ id = (known after apply)
+ name = "Control Tower Guardrails"
+ tags_all = (known after apply)
+ type = "SERVICE_CONTROL_POLICY"
}
# aws_organizations_policy_attachment.Test-aws_nuke_guardrails will be created
+ resource "aws_organizations_policy_attachment" "Test-aws_nuke_guardrails" {
+ id = (known after apply)
+ policy_id = (known after apply)
+ target_id = "ou-5gsq-ectrrn9m"
}
Plan: 2 to add, 0 to change, 0 to destroy.
─────────────────────────────────────────────────────────────────────────────
Saved the plan to: plan.tfplan
To perform exactly these actions, run the following command to apply:
terraform apply "plan.tfplan"
Show Conftest resultsWARN - plan.json - main - Missing Common Tags: ["aws_organizations_organizational_unit.AFT"]
WARN - plan.json - main - Missing Common Tags: ["aws_organizations_organizational_unit.DumpsterFire"]
WARN - plan.json - main - Missing Common Tags: ["aws_organizations_organizational_unit.Production"]
WARN - plan.json - main - Missing Common Tags: ["aws_organizations_organizational_unit.SRETools"]
WARN - plan.json - main - Missing Common Tags: ["aws_organizations_organizational_unit.Sandbox"]
WARN - plan.json - main - Missing Common Tags: ["aws_organizations_organizational_unit.Security"]
WARN - plan.json - main - Missing Common Tags: ["aws_organizations_organizational_unit.Staging"]
WARN - plan.json - main - Missing Common Tags: ["aws_organizations_organizational_unit.Test"]
WARN - plan.json - main - Missing Common Tags: ["aws_organizations_policy.aws_nuke_guardrails"]
WARN - plan.json - main - Missing Common Tags: ["aws_organizations_policy.cds_snc_universal_guardrails"]
WARN - plan.json - main - Missing Common Tags: ["aws_organizations_policy.qurantine_deny_all_policy"]
30 tests, 19 passed, 11 warnings, 0 failures, 0 exceptions
|
Plan for org_account/roles✅ Terraform Init: Plan: 0 to add, 2 to change, 0 to destroy Show summary
Show planResource actions are indicated with the following symbols:
~ update in-place
Terraform will perform the following actions:
# aws_iam_policy.sre_bot_policy will be updated in-place
~ resource "aws_iam_policy" "sre_bot_policy" {
id = "arn:aws:iam::659087519042:policy/sre_bot_policy"
name = "sre_bot_policy"
~ policy = jsonencode(
~ {
~ Statement = [
# (2 unchanged elements hidden)
{
Action = [
"identitystore:UpdateUser",
"identitystore:ListUsers",
"identitystore:ListGroups",
"identitystore:ListGroupMembershipsForMember",
"identitystore:ListGroupMemberships",
"identitystore:IsMemberInGroups",
"identitystore:GetUserId",
"identitystore:GetGroupMembershipId",
"identitystore:GetGroupId",
"identitystore:DescribeUser",
"identitystore:DescribeGroupMembership",
"identitystore:DescribeGroup",
"identitystore:DeleteUser",
"identitystore:DeleteGroupMembership",
"identitystore:CreateUser",
"identitystore:CreateGroupMembership",
]
Effect = "Allow"
Resource = "*"
Sid = "ManageIdentityStoreUsers"
},
- {
- Action = [
- "sso:List*",
]
- Effect = "Allow"
- Resource = [
- "*",
]
- Sid = "sso"
},
]
# (1 unchanged attribute hidden)
}
)
tags = {
"CostCentre" = "cds-aws-lz-production"
"Terraform" = "true"
}
# (4 unchanged attributes hidden)
}
# aws_iam_role.sre_bot will be updated in-place
~ resource "aws_iam_role" "sre_bot" {
~ assume_role_policy = (sensitive value)
id = "sre_bot_role"
name = "sre_bot_role"
tags = {
"CostCentre" = "cds-aws-lz-production"
"Terraform" = "true"
}
# (9 unchanged attributes hidden)
}
Plan: 0 to add, 2 to change, 0 to destroy.
─────────────────────────────────────────────────────────────────────────────
Saved the plan to: plan.tfplan
To perform exactly these actions, run the following command to apply:
terraform apply "plan.tfplan"
Show Conftest resultsWARN - plan.json - main - Missing Common Tags: ["aws_iam_policy.org_account_list_in_sandbox"]
WARN - plan.json - main - Missing Common Tags: ["aws_iam_policy.org_allow_policy_toggle"]
21 tests, 19 passed, 2 warnings, 0 failures, 0 exceptions
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary | Résumé
Attempt to further restrict possible locking out of accounts via AWS Nuke